<?php
namespace Admin\Model;
use Think\Model;
class QudaoModel extends Model {

	/**
	 * 混合处理搜索
	 * @return [type] [description]
	 */
	public function qudao_list(){
		/******************搜索处理*******************************/
 		$type=$_GET['type']?$_GET['type']:0;
		$my_types=explode(',',$type);
		for ($i=0; $i < count($my_types); $i++) { 
			$my_type[$i]="%".diy_qudao_name($my_types[$i])."%";
		}
		if($my_type){
			$where['qudao_type']=array('LIKE',$my_type);
		}
		if($_GET['search']){
			$where['qudao_name']=array('LIKE',"%".$_GET['search']."%");
		}
		/******************搜索处理*******************************/
		$where['p_u_id']=$_SESSION['user']['u_id'];
		if(!$_GET['p'])$_get['p']=1;
		$count=M('web_user')
		->alias('a')
		->join('bm_qudao b ON a.qudao_id = b.qudao_id',"LEFT")
		->field('
			a.web_id,
			a.web_pro_id,
			a.web_city_id,
			a.web_area_id,
			a.web_time,
			a.web_phone,
			a.web_name,
			b.qudao_type,
			b.qudao_name
			')
		->where($where)
		->limit($Page->firstRow.','.$Page->listRows)
		->count();
		$Page       = new \Think\Page($count,10);
		$show       = $Page->show();
		$list=M('web_user')
		->alias('a')
		->join('bm_qudao b ON a.qudao_id = b.qudao_id',"LEFT")
		->field('
			a.web_id,
			a.web_pro_id,
			a.web_city_id,
			a.web_area_id,
			a.web_time,
			a.web_phone,
			a.web_name,
			b.qudao_type,
			b.qudao_name
			')
		->where($where)
		->limit($Page->firstRow.','.$Page->listRows)
		->select();
		$rs['count']=$count;
		$rs['list']=$list;
		$rs['show']=$show;
		return $rs;
	}
}